home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / eulisp / feel0_89.lha / Feel / Boot / init.em.bak < prev    next >
Encoding:
Text File  |  1993-07-28  |  50.6 KB  |  397 lines

  1. (
  2. defmodule
  3. init
  4. (arith bci lists classes sockets streams ccc symbols strings calls others tables vectors (except (error cerror) errors) (only (set-compute-and-apply-fn generic-function-p methodp call-method-by-list) generics) class-names)
  5. ()
  6. (expose arith bci lists classes sockets streams ccc symbols strings calls others tables vectors (except (error cerror) errors) (only (set-compute-and-apply-fn generic-function-p methodp call-method-by-list) generics) class-names)
  7. (export <object>)
  8. (set-class-of <object> <class>)
  9. (export <class>)
  10. (set-class-of <class> <class>)
  11. (defconstant <instantiable-class> (allocate-object <class>))
  12. (export <instantiable-class>)
  13. (set-class-of <instantiable-class> <class>)
  14. (defconstant <si-class> (allocate-object <class>))
  15. (export <si-class>)
  16. (set-class-of <si-class> <class>)
  17. (defconstant <abstract-class> (allocate-object <class>))
  18. (export <abstract-class>)
  19. (set-class-of <abstract-class> <class>)
  20. (defconstant <structure-class> (allocate-object <class>))
  21. (export <structure-class>)
  22. (set-class-of <structure-class> <class>)
  23. (defconstant <mi-class> (allocate-object <class>))
  24. (export <mi-class>)
  25. (set-class-of <mi-class> <class>)
  26. (defconstant <slot-description-class> (allocate-object <class>))
  27. (export <slot-description-class>)
  28. (set-class-of <slot-description-class> <class>)
  29. (defconstant <structure> (allocate-object <class>))
  30. (export <structure>)
  31. (set-class-of <structure> <structure-class>)
  32. (defconstant <slot-description> (allocate-object <class>))
  33. (export <slot-description>)
  34. (set-class-of <slot-description> <slot-description-class>)
  35. (defconstant <local-slot-description> (allocate-object <class>))
  36. (export <local-slot-description>)
  37. (set-class-of <local-slot-description> <class>)
  38. (defconstant <unreadable-slot-description> (allocate-object <class>))
  39. (export <unreadable-slot-description>)
  40. (set-class-of <unreadable-slot-description> <slot-description-class>)
  41. (export <funcallable-object-class>)
  42. (set-class-of <funcallable-object-class> <class>)
  43. (export <generic-class>)
  44. (set-class-of <generic-class> <class>)
  45. (export <bytefunction-class>)
  46. (set-class-of <bytefunction-class> <class>)
  47. (defconstant <funcallable-object> (allocate-object <class>))
  48. (export <funcallable-object>)
  49. (set-class-of <funcallable-object> <funcallable-object-class>)
  50. (export <function>)
  51. (set-class-of <function> <funcallable-object-class>)
  52. (export <i-function>)
  53. (set-class-of <i-function> <funcallable-object-class>)
  54. (export <c-function>)
  55. (set-class-of <c-function> <funcallable-object-class>)
  56. (export <bytefunction>)
  57. (set-class-of <bytefunction> <bytefunction-class>)
  58. (export <extended-bytefunction>)
  59. (set-class-of <extended-bytefunction> <bytefunction-class>)
  60. (export <generic-function>)
  61. (set-class-of <generic-function> <generic-class>)
  62. (export <method-class>)
  63. (set-class-of <method-class> <class>)
  64. (export <method>)
  65. (set-class-of <method> <method-class>)
  66. (export <condition-class>)
  67. (set-class-of <condition-class> <class>)
  68. (export <condition>)
  69. (set-class-of <condition> <condition-class>)
  70. (export <Internal-Error>)
  71. (set-class-of <Internal-Error> <condition-class>)
  72. (export <clock-tick>)
  73. (set-class-of <clock-tick> <condition-class>)
  74. (defconstant <invalid-operator> (allocate-object <class>))
  75. (export <invalid-operator>)
  76. (set-class-of <invalid-operator> <condition-class>)
  77. (export <thread-class>)
  78. (set-class-of <thread-class> <class>)
  79. (export <thread>)
  80. (set-class-of <thread> <thread-class>)
  81. (export <primitive-class>)
  82. (set-class-of <primitive-class> <class>)
  83. (export <character>)
  84. (set-class-of <character> <primitive-class>)
  85. (export <symbol>)
  86. (set-class-of <symbol> <primitive-class>)
  87. (export <weak-wrapper>)
  88. (set-class-of <weak-wrapper> <primitive-class>)
  89. (export <continuation>)
  90. (set-class-of <continuation> <primitive-class>)
  91. (export <socket>)
  92. (set-class-of <socket> <primitive-class>)
  93. (export <listener>)
  94. (set-class-of <listener> <primitive-class>)
  95. (defconstant <collection> (allocate-object <class>))
  96. (export <collection>)
  97. (set-class-of <collection> <abstract-class>)
  98. (export <table>)
  99. (set-class-of <table> <class>)
  100. (defconstant <sequence> (allocate-object <class>))
  101. (export <sequence>)
  102. (set-class-of <sequence> <abstract-class>)
  103. (export <string>)
  104. (set-class-of <string> <primitive-class>)
  105. (defconstant <vector-class> (allocate-object <class>))
  106. (export <vector-class>)
  107. (set-class-of <vector-class> <class>)
  108. (export <vector>)
  109. (set-class-of <vector> <vector-class>)
  110. (defconstant <number-class> (allocate-object <class>))
  111. (export <number-class>)
  112. (set-class-of <number-class> <class>)
  113. (export <number>)
  114. (set-class-of <number> <number-class>)
  115. (defconstant <float> (allocate-object <class>))
  116. (export <float>)
  117. (set-class-of <float> <class>)
  118. (export <double-float>)
  119. (set-class-of <double-float> <number-class>)
  120. (defconstant <integer> (allocate-object <class>))
  121. (export <integer>)
  122. (set-class-of <integer> <number-class>)
  123. (export <fixint>)
  124. (set-class-of <fixint> <number-class>)
  125. (defconstant <list> (allocate-object <class>))
  126. (export <list>)
  127. (set-class-of <list> <class>)
  128. (export <pair>)
  129. (set-class-of <pair> <primitive-class>)
  130. (export <null>)
  131. (set-class-of <null> <primitive-class>)
  132. (defconstant <special-method> (allocate-object <class>))
  133. (export <special-method>)
  134. (set-class-of <special-method> <class>)
  135. (defconstant mapcar1 mapcar)
  136. (defconstant mapc1 mapc)
  137. (defconstant unbound-slot-value (quote %_*unbound*_%))
  138. (export unbound-slot-value class-type)
  139. (defconstant generic-type 164)
  140. (defconstant method-type 37)
  141. (defconstant class-type 13)
  142. (defun fill-class (class desc) (primitive-set-slot-ref-1 class (car desc)) (setq desc (cdr desc)) (primitive-set-slot-ref-0 class (car desc)) (setq desc (cdr desc)) (primitive-set-slot-ref-8 class (car desc)) (setq desc (cdr desc)) (primitive-set-slot-ref-2 class (car desc)) (setq desc (cdr desc)) (primitive-set-slot-ref-7 class (car desc)) (setq desc (cdr desc)) (primitive-set-slot-ref-3 class nil) (set-type class class-type) (mapc1 (lambda (cl) (primitive-set-slot-ref-3 cl (cons class (primitive-slot-ref-3 cl)))) (primitive-slot-ref-2 class)))
  143. (defun initialise-hierarchy (lst) (if (null lst) nil (progn (fill-class (car (car lst)) (cdr (car lst))) (initialise-hierarchy (cdr lst)))))
  144. (initialise-hierarchy (list (list <object> (quote <object>) 0 (quote ()) (list) (list <object>)) (list <class> (quote <class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <object>) (list <class> <object>)) (list <instantiable-class> (quote <instantiable-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <class>) (list <instantiable-class> <class> <object>)) (list <si-class> (quote <si-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <instantiable-class>) (list <si-class> <instantiable-class> <class> <object>)) (list <abstract-class> (quote <abstract-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <class>) (list <abstract-class> <class> <object>)) (list <structure-class> (quote <structure-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <si-class>) (list <structure-class> <si-class> <instantiable-class> <class> <object>)) (list <mi-class> (quote <mi-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <instantiable-class>) (list <mi-class> <instantiable-class> <class> <object>)) (list <slot-description-class> (quote <slot-description-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <class>) (list <slot-description-class> <class> <object>)) (list <structure> (quote <structure>) 0 (quote ()) (list <object>) (list <structure> <object>)) (list <slot-description> (quote <slot-description>) 6 (quote (name position initfunction reader writer initarg)) (list <object>) (list <slot-description> <object>)) (list <local-slot-description> (quote <local-slot-description>) 6 (quote (name position initfunction reader writer initarg)) (list <slot-description>) (list <local-slot-description> <slot-description> <object>)) (list <unreadable-slot-description> (quote <unreadable-slot-description>) 6 (quote (name position initfunction reader writer initarg)) (list <local-slot-description>) (list <unreadable-slot-description> <local-slot-description> <slot-description> <object>)) (list <funcallable-object-class> (quote <funcallable-object-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <class>) (list <funcallable-object-class> <class> <object>)) (list <generic-class> (quote <generic-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <funcallable-object-class>) (list <generic-class> <funcallable-object-class> <class> <object>)) (list <bytefunction-class> (quote <bytefunction-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <funcallable-object-class>) (list <bytefunction-class> <funcallable-object-class> <class> <object>)) (list <funcallable-object> (quote <funcallable-object>) 0 (quote ()) (list <object>) (list <funcallable-object> <object>)) (list <function> (quote <function>) 5 (quote ()) (list <funcallable-object>) (list <function> <funcallable-object> <object>)) (list <i-function> (quote <i-function>) 6 (quote ()) (list <function>) (list <i-function> <function> <funcallable-object> <object>)) (list <c-function> (quote <c-function>) 5 (quote ()) (list <function>) (list <c-function> <function> <funcallable-object> <object>)) (list <bytefunction> (quote <bytefunction>) 5 (quote ()) (list <funcallable-object>) (list <bytefunction> <funcallable-object> <object>)) (list <extended-bytefunction> (quote <extended-bytefunction>) 6 (quote ()) (list <bytefunction>) (list <extended-bytefunction> <bytefunction> <funcallable-object> <object>)) (list <generic-function> (quote <generic-function>) 10 (quote (method-class methods domain)) (list <funcallable-object>) (list <generic-function> <funcallable-object> <object>)) (list <method-class> (quote <method-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <class>) (list <method-class> <class> <object>)) (list <method> (quote <method>) 5 (quote (domain range function signature)) (list <object>) (list <method> <object>)) (list <condition-class> (quote <condition-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <class>) (list <condition-class> <class> <object>)) (list <condition> (quote <condition>) 2 (quote (message error-value)) (list <object>) (list <condition> <object>)) (list <Internal-Error> (quote <Internal-Error>) 2 (quote (message error-value)) (list <condition>) (list <Internal-Error> <condition> <object>)) (list <clock-tick> (quote <clock-tick>) 2 (quote (message error-value)) (list <condition>) (list <clock-tick> <condition> <object>)) (list <invalid-operator> (quote <invalid-operator>) 4 (quote (message error-value)) (list <condition>) (list <invalid-operator> <condition> <object>)) (list <thread-class> (quote <thread-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <class>) (list <thread-class> <class> <object>)) (list <thread> (quote <thread>) 7 (quote ()) (list <object>) (list <thread> <object>)) (list <primitive-class> (quote <primitive-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <class>) (list <primitive-class> <class> <object>)) (list <character> (quote <character>) 0 (quote ()) (list <object>) (list <character> <object>)) (list <symbol> (quote <symbol>) 0 (quote ()) (list <object>) (list <symbol> <object>)) (list <weak-wrapper> (quote <weak-wrapper>) 0 (quote ()) (list <object>) (list <weak-wrapper> <object>)) (list <continuation> (quote <continuation>) 0 (quote ()) (list <funcallable-object>) (list <continuation> <funcallable-object> <object>)) (list <socket> (quote <socket>) 0 (quote ()) (list <object>) (list <socket> <object>)) (list <listener> (quote <listener>) 0 (quote ()) (list <object>) (list <listener> <object>)) (list <collection> (quote <collection>) 0 (quote ()) (list <object>) (list <collection> <object>)) (list <table> (quote <table>) 7 (quote ()) (list <collection>) (list <table> <collection> <object>)) (list <sequence> (quote <sequence>) 0 (quote ()) (list <collection>) (list <sequence> <collection> <object>)) (list <string> (quote <string>) 0 (quote ()) (list <sequence>) (list <string> <sequence> <collection> <object>)) (list <vector-class> (quote <vector-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <primitive-class>) (list <vector-class> <primitive-class> <class> <object>)) (list <vector> (quote <vector>) 0 (quote ()) (list <sequence>) (list <vector> <sequence> <collection> <object>)) (list <number-class> (quote <number-class>) 10 (quote (direct-superclasses direct-slot-descriptions direct-initargs name)) (list <primitive-class>) (list <number-class> <primitive-class> <class> <object>)) (list <number> (quote <number>) 0 (quote ()) (list <object>) (list <number> <object>)) (list <float> (quote <float>) 0 (quote ()) (list <number>) (list <float> <number> <object>)) (list <double-float> (quote <double-float>) 0 (quote ()) (list <float>) (list <double-float> <float> <number> <object>)) (list <integer> (quote <integer>) 0 (quote ()) (list <number>) (list <integer> <number> <object>)) (list <fixint> (quote <fixint>) 0 (quote ()) (list <integer>) (list <fixint> <integer> <number> <object>)) (list <list> (quote <list>) 0 (quote ()) (list <sequence>) (list <list> <sequence> <collection> <object>)) (list <pair> (quote <pair>) 0 (quote ()) (list <list>) (list <pair> <list> <sequence> <collection> <object>)) (list <null> (quote <null>) 0 (quote ()) (list <list>) (list <null> <list> <sequence> <collection> <object>)) (list <special-method> (quote <special-method>) 1 (quote (id)) (list <object>) (list <special-method> <object>))))
  145. (defun i-add1 (x) (binary+_Integer x 1))
  146. (defun i-sub1 (x) (binary-_Integer x 1))
  147. (defun i-zerop (x) (binary=_Integer 0 x))
  148. (defun i-greaterp (x y) (binary<_Integer y x))
  149. (defun fold (fn lst val) (if (null lst) val (fold fn (cdr lst) (fn (car lst) val))))
  150. (export fold)
  151. (defun reverse (x) (fold cons x nil))
  152. (defun assq (x lst) (if (null lst) nil (if (eq (car (car lst)) x) (car lst) (assq x (cdr lst)))))
  153. (defun identity (x) x)
  154. (defconstant slot-readers (make-initialized-vector primitive-slot-ref-0 primitive-slot-ref-1 primitive-slot-ref-2 primitive-slot-ref-3 primitive-slot-ref-4 primitive-slot-ref-5 primitive-slot-ref-6 primitive-slot-ref-7 primitive-slot-ref-8 primitive-slot-ref-9))
  155. (defconstant slot-writers (make-initialized-vector primitive-set-slot-ref-0 primitive-set-slot-ref-1 primitive-set-slot-ref-2 primitive-set-slot-ref-3 primitive-set-slot-ref-4 primitive-set-slot-ref-5 primitive-set-slot-ref-6 primitive-set-slot-ref-7 primitive-set-slot-ref-8 primitive-set-slot-ref-9))
  156. (defun %compute-reader (n) (if (i-greaterp 10 n) (vector-ref slot-readers n) (lambda (***method-status-handle*** ***method-args-handle*** x) (primitive-slot-ref x n))))
  157. (defun %compute-writer (n) (if (i-greaterp 10 n) (vector-ref slot-writers n) (lambda (***method-status-handle*** ***method-args-handle*** x v) (primitive-set-slot-ref x n v))))
  158. (defun make-initial-table (key entry) (mk-tab-aux key entry))
  159. (defun mk-tab-aux (key entry) ((lambda (add-part) (setq add-part (lambda (lst tab) (if (null lst) tab (add-part (cdr lst) (cons (cons (car lst) tab) nil))))) (add-part (reverse key) entry)) ()))
  160. (defun add-table-entry (table key value) (if (null table) (error "Can't happen" <Internal-Error>) ((lambda (xx) (if (null xx) (progn (nconc table (make-initial-table key value)) table) (if (null (cdr key)) (primitive-set-slot-ref-1 xx value) (add-table-entry (cdr xx) (cdr key) value)))) (assq (car key) table))))
  161. (defun symbol-unbraced-name (sym) ((lambda (x) (if (eq (string-ref x 0) #\<) (substring x 1 (i-sub1 (i-sub1 (string-length x)))) x)) (symbol-name sym)))
  162. (export symbol-unbraced-name)
  163. (defun scan-args (arg init-lst panic) ((lambda (scan-aux) (setq scan-aux (lambda (arg lst) (if (null lst) (panic arg init-lst) (if (eq (car lst) arg) (car (cdr lst)) (scan-aux arg (cdr (cdr lst))))))) (scan-aux arg init-lst)) ()))
  164. (defun required-argument (arg args) (error "Missing init-argument" <Internal-Error> (quote error-value) arg))
  165. (defun unbound-argument (arg args) unbound-slot-value)
  166. (defun null-argument (arg args) nil)
  167. (defun default-argument (x) (lambda (arg args) x))
  168. (export required-argument unbound-argument null-argument default-argument scan-args)
  169. (defun simple-compute-method-lookup-function (gf domain) (lambda (args) (find-applicable-methods gf args)))
  170. (defun %generic-domain (gf) ((lambda (dom) (if dom dom ((lambda (obj) (primitive-set-slot-ref-1 obj obj) obj) (list <object>)))) (cdr (primitive-slot-ref-6 gf))))
  171. (defun method-signature-depth (gf meth) ((lambda (sig domain) ((lambda (calc-depth) (setq calc-depth (lambda (lst domain depth n) (if (null lst) depth (if (eq (car lst) (car domain)) (calc-depth (cdr lst) (cdr domain) depth (i-add1 n)) (calc-depth (cdr lst) (cdr domain) (i-add1 n) (i-add1 n)))))) (calc-depth sig domain 0 0)) ())) (primitive-slot-ref-1 meth) (%generic-domain gf)))
  172. (defun simple-add-method (gf meth) ((lambda (sig table) (if (null table) (primitive-set-slot-ref-5 gf (make-initial-table sig (list meth))) (add-table-entry table sig (list meth))) (primitive-set-slot-ref-3 gf nil) (primitive-set-slot-ref-4 gf nil) (primitive-set-slot-ref-2 meth gf) ((lambda (true-depth) (if (i-greaterp true-depth (primitive-slot-ref-8 gf)) (primitive-set-slot-ref-8 gf true-depth) nil)) (method-signature-depth gf meth)) gf) (primitive-slot-ref-1 meth) (primitive-slot-ref-5 gf)))
  173. (defun std-generic-discriminator (gf lookup) (lambda (args) ((lambda (meths) (if (null meths) (error "No applicable method" no-applicable-method (quote sig) (mapcar1 class-of args)) (call-method-by-list meths args))) (lookup args))))
  174. (defun simple-make-generic args ((lambda (obj) (primitive-set-slot-ref-0 obj (scan-args (quote name) args required-argument)) (primitive-set-slot-ref-2 obj (scan-args (quote argtype) args required-argument)) (primitive-set-slot-ref-3 obj nil) (primitive-set-slot-ref-4 obj nil) (primitive-set-slot-ref-5 obj nil) (primitive-set-slot-ref-6 obj (cons <method> (scan-args (quote domain) args null-argument))) ((lambda (lookup) (primitive-set-slot-ref-7 obj lookup) (primitive-set-slot-ref-1 obj (std-generic-discriminator obj lookup))) (simple-compute-method-lookup-function obj nil)) (primitive-set-slot-ref-8 obj 0) (set-type obj generic-type) obj) (allocate-object <generic-function>)))
  175. (defun simple-make-method args ((lambda (meth) (primitive-set-slot-ref-0 meth nil) (primitive-set-slot-ref-2 meth nil) (primitive-set-slot-ref-1 meth (scan-args (quote signature) args required-argument)) (primitive-set-slot-ref-3 meth (scan-args (quote function) args required-argument)) (primitive-set-slot-ref-4 meth (scan-args (quote fixed) args null-argument)) (set-type meth method-type) meth) (allocate-object <method>)))
  176. (defun simple-compute-reader (cl args) ((lambda (pos gf) (if (eq (scan-args (quote class) args null-argument) <unreadable-slot-description>) (simple-add-method gf (simple-make-method (quote signature) (list cl) (quote function) (lambda (***method-status-handle*** ***method-args-handle*** o) (error "Can't read slot" <Internal-Error>)))) (simple-add-method gf (simple-make-method (quote signature) (list cl) (quote function) (%compute-reader pos)))) gf) (scan-args (quote position) args required-argument) (simple-make-generic (quote argtype) 1 (quote name) (make-symbol (string-append (symbol-unbraced-name (scan-args (quote owner-class) args (default-argument (quote anonymous)))) (string-append "-" (symbol-name (scan-args (quote name) args required-argument))))))))
  177. (defun simple-compute-writer (cl args) ((lambda (pos gf) (if (eq (scan-args (quote class) args null-argument) <unreadable-slot-description>) (simple-add-method gf (simple-make-method (quote signature) (list cl <object>) (quote function) (lambda (***method-status-handle*** ***method-args-handle*** o v) (error "Can't set slot" <Internal-Error>)))) (simple-add-method gf (simple-make-method (quote signature) (list cl <object>) (quote function) (%compute-writer pos)))) gf) (scan-args (quote position) args null-argument) (simple-make-generic (quote argtype) 2 (quote domain) (list cl <object>) (quote name) (make-symbol (string-append (string-append (symbol-name (scan-args (quote owner-class) args (default-argument (quote anonymous)))) (string-append "-" (symbol-name (scan-args (quote name) args required-argument)))) "-setter")))))
  178. (defun fill-slot-description (obj class args) ((lambda (access-args) (setq args (cdr (cdr args))) (primitive-set-slot-ref-0 obj (car args)) (setq args (cdr args)) (primitive-set-slot-ref-1 obj (car args)) (setq args (cdr args)) ((lambda (initform) (primitive-set-slot-ref-3 obj (if (eq initform unbound-slot-value) unbound-slot-value (lambda () initform)))) (car args)) (setq args (cdr args)) (primitive-set-slot-ref-2 obj (car args)) (primitive-set-slot-ref-5 obj (simple-compute-reader class access-args)) (primitive-set-slot-ref-4 obj (simple-compute-writer class access-args)) obj) (list (quote class) (car args) (quote owner-class) (car (cdr args)) (quote name) (car (cdr (cdr args))) (quote position) (car (cdr (cdr (cdr args)))))))
  179. (defun simple-find-slot-description (class name) ((lambda (xx) ((lambda (l1) (setq l1 (lambda (slots) (if (null slots) (error "Could not find slot" <Internal-Error> (quote error-value) name) (if (eq (primitive-slot-ref-0 (car slots)) name) (car slots) (l1 (cdr slots)))))) (l1 xx)) ())) (primitive-slot-ref-5 class)))
  180. (defun simple-find-slot-reader (class slot-name) (primitive-slot-ref-5 (simple-find-slot-description class slot-name)))
  181. (defun simple-find-slot-writer (class slot-name) (primitive-slot-ref-4 (simple-find-slot-description class slot-name)))
  182. (defun simple-find-accessor (class slot-name) ((lambda (reader writer) (primitive-set-slot-ref-9 reader writer) reader) (simple-find-slot-reader class slot-name) (simple-find-slot-writer class slot-name)))
  183. (defun initialize-slots (lst) (if (null lst) nil ((lambda (class slots) (primitive-set-slot-ref-5 class (append (if (null (primitive-slot-ref-2 class)) nil (primitive-slot-ref-5 (car (primitive-slot-ref-2 class)))) (make-slot-list class slots))) (primitive-set-slot-ref-4 class (mapcar1 (lambda (sd) nil) (primitive-slot-ref-5 class))) (primitive-set-slot-ref-6 class (primitive-slot-ref-5 class)) (initialize-slots (cdr lst))) (car (car lst)) (cdr (car lst)))))
  184. (defun make-slot-list (class slotds) (if (null slotds) nil ((lambda (slotd slot) (fill-slot-description slot class (cons (car slotd) (cons (primitive-slot-ref-1 class) (cdr slotd)))) (cons slot (make-slot-list class (cdr slotds)))) (car slotds) (allocate-object (car (car slotds))))))
  185. (defconstant internal-gf-setter-setter primitive-set-slot-ref-9)
  186. (defconstant internal-gf-setter primitive-slot-ref-9)
  187. (defconstant internal-gf-method-table (lambda (x) (primitive-slot-ref-5 x)))
  188. (defconstant internal-gf-name (lambda (x) (primitive-slot-ref-0 x)))
  189. (defconstant internal-gf-discrimination-depth (lambda (x) (primitive-slot-ref-8 x)))
  190. (defconstant internal-gf-method-lookup-function (lambda (x) (primitive-slot-ref-7 x)))
  191. (defconstant internal-class-precedence-list (lambda (x) (primitive-slot-ref-7 x)))
  192. (defun init-generic (gf) ((lambda (lookup) (primitive-set-slot-ref-7 gf lookup) (primitive-set-slot-ref-1 gf (std-generic-discriminator gf lookup)) (primitive-set-slot-ref-6 gf (cons <method> nil))) (simple-compute-method-lookup-function gf nil)))
  193. (defun add-method-to-caches (gf sig meths) (primitive-set-slot-ref-3 gf (cons sig meths)) ((lambda (table) (if (null table) (primitive-set-slot-ref-4 gf (make-initial-table sig (cons sig meths))) (add-table-entry table sig (cons sig meths)))) (primitive-slot-ref-4 gf)))
  194. (initialize-slots (list (list <object>) (list <class> (list <local-slot-description> (quote instance-size) 0 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote name) 1 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote super-classes) 2 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote subclasses) 3 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote local-slot-descriptions) 4 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote slot-descriptions) 5 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote non-local-descriptions) 6 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote precedence) 7 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote initargs) 8 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote spare) 9 (quote %_*unbound*_%) (quote %_*unbound*_%))) (list <instantiable-class>) (list <si-class>) (list <abstract-class>) (list <structure-class>) (list <mi-class>) (list <slot-description-class>) (list <structure>) (list <slot-description> (list <local-slot-description> (quote name) 0 (quote %_*unbound*_%) (quote name)) (list <local-slot-description> (quote position) 1 (quote %_*unbound*_%) (quote position)) (list <local-slot-description> (quote initarg) 2 (quote %_*unbound*_%) (quote initarg)) (list <local-slot-description> (quote initfunction) 3 (quote %_*unbound*_%) (quote initfunction)) (list <local-slot-description> (quote slot-writer) 4 (quote %_*unbound*_%) (quote writer)) (list <local-slot-description> (quote slot-reader) 5 (quote %_*unbound*_%) (quote reader))) (list <local-slot-description>) (list <unreadable-slot-description>) (list <funcallable-object-class>) (list <generic-class>) (list <bytefunction-class>) (list <funcallable-object>) (list <function> (list <unreadable-slot-description> (quote argtype) 0 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <unreadable-slot-description> (quote env) 1 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <unreadable-slot-description> (quote xxx) 2 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote name) 3 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote home) 4 (quote %_*unbound*_%) (quote %_*unbound*_%))) (list <i-function> (list <local-slot-description> (quote body) 5 (quote %_*unbound*_%) (quote %_*unbound*_%))) (list <c-function>) (list <bytefunction> (list <local-slot-description> (quote env) 0 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote offset) 1 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote nargs) 2 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote globals) 3 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote setter) 4 (quote %_*unbound*_%) (quote %_*unbound*_%))) (list <extended-bytefunction> (list <local-slot-description> (quote info) 5 (quote %_*unbound*_%) (quote %_*unbound*_%))) (list <generic-function> (list <local-slot-description> (quote name) 0 (quote %_*unbound*_%) (quote name)) (list <local-slot-description> (quote discriminator) 1 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote argtype) 2 (quote %_*unbound*_%) (quote argtype)) (list <local-slot-description> (quote fast-cache) 3 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote slow-cache) 4 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote method-table) 5 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote method-description) 6 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote method-lookup-function) 7 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote discrimination-depth) 8 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote setter) 9 (quote %_*unbound*_%) (quote %_*unbound*_%))) (list <method-class>) (list <method> (list <local-slot-description> (quote method-qualifier) 0 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote signature) 1 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote generic-function) 2 (quote ()) (quote %_*unbound*_%)) (list <local-slot-description> (quote function) 3 (quote %_*unbound*_%) (quote function)) (list <local-slot-description> (quote fixed) 4 (quote %_*unbound*_%) (quote %_*unbound*_%))) (list <condition-class>) (list <condition> (list <local-slot-description> (quote message) 0 (quote %_*unbound*_%) (quote message)) (list <local-slot-description> (quote error-value) 1 (quote %_*unbound*_%) (quote error-value))) (list <Internal-Error>) (list <clock-tick>) (list <invalid-operator> (list <local-slot-description> (quote args) 2 (quote %_*unbound*_%) (quote args)) (list <local-slot-description> (quote op) 3 (quote %_*unbound*_%) (quote op))) (list <thread-class>) (list <thread> (list <local-slot-description> (quote data) 0 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote state) 1 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <unreadable-slot-description> (quote fun) 2 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote args) 3 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote value) 4 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <unreadable-slot-description> (quote cochain) 5 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote signal-list) 6 (quote %_*unbound*_%) (quote %_*unbound*_%))) (list <primitive-class>) (list <character>) (list <symbol>) (list <weak-wrapper>) (list <continuation>) (list <socket>) (list <listener>) (list <collection>) (list <table> (list <local-slot-description> (quote table-values) 0 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote table-population) 1 (quote 0) (quote %_*unbound*_%)) (list <local-slot-description> (quote table-threshold) 2 (quote 14) (quote %_*unbound*_%)) (list <local-slot-description> (quote table-filled) 3 (quote %_*unbound*_%) (quote %_*unbound*_%)) (list <local-slot-description> (quote table-comparator) 4 (quote ()) (quote comparator)) (list <local-slot-description> (quote table-hash-function) 5 (quote ()) (quote hash-function)) (list <local-slot-description> (quote table-fill) 6 (quote ()) (quote fill))) (list <sequence>) (list <string>) (list <vector-class>) (list <vector>) (list <number-class>) (list <number>) (list <float>) (list <double-float>) (list <integer>) (list <fixint>) (list <list>) (list <pair>) (list <null>) (list <special-method> (list <local-slot-description> (quote id) 0 (quote %_*unbound*_%) (quote id)))))
  195. (defconstant class-instance-size (simple-find-accessor <class> (quote instance-size)))
  196. (export class-instance-size)
  197. (defconstant class-name (simple-find-accessor <class> (quote name)))
  198. (export class-name)
  199. (defconstant class-direct-superclasses (simple-find-accessor <class> (quote super-classes)))
  200. (export class-direct-superclasses)
  201. (defconstant class-direct-subclasses (simple-find-accessor <class> (quote subclasses)))
  202. (export class-direct-subclasses)
  203. (defconstant class-local-slot-descriptions (simple-find-accessor <class> (quote local-slot-descriptions)))
  204. (export class-local-slot-descriptions)
  205. (defconstant class-slot-descriptions (simple-find-accessor <class> (quote slot-descriptions)))
  206. (export class-slot-descriptions)
  207. (defconstant class-non-local-slot-descriptions (simple-find-accessor <class> (quote non-local-descriptions)))
  208. (export class-non-local-slot-descriptions)
  209. (defconstant class-precedence-list (simple-find-accessor <class> (quote precedence)))
  210. (export class-precedence-list)
  211. (defconstant class-initargs (simple-find-accessor <class> (quote initargs)))
  212. (export class-initargs)
  213. (defconstant class-spare (simple-find-accessor <class> (quote spare)))
  214. (export class-spare)
  215. (defconstant slot-description-name (simple-find-accessor <slot-description> (quote name)))
  216. (export slot-description-name)
  217. (defconstant slot-description-position (simple-find-accessor <slot-description> (quote position)))
  218. (export slot-description-position)
  219. (defconstant slot-description-initarg (simple-find-accessor <slot-description> (quote initarg)))
  220. (export slot-description-initarg)
  221. (defconstant slot-description-initfunction (simple-find-accessor <slot-description> (quote initfunction)))
  222. (export slot-description-initfunction)
  223. (defconstant slot-description-slot-writer (simple-find-accessor <slot-description> (quote slot-writer)))
  224. (export slot-description-slot-writer)
  225. (defconstant slot-description-slot-reader (simple-find-accessor <slot-description> (quote slot-reader)))
  226. (export slot-description-slot-reader)
  227. (defconstant function-name (simple-find-accessor <function> (quote name)))
  228. (export function-name)
  229. (defconstant function-home (simple-find-accessor <function> (quote home)))
  230. (export function-home)
  231. (defconstant i-function-body (simple-find-accessor <i-function> (quote body)))
  232. (export i-function-body)
  233. (defconstant bytefunction-env (simple-find-accessor <bytefunction> (quote env)))
  234. (export bytefunction-env)
  235. (defconstant extended-bytefunction-info (simple-find-accessor <extended-bytefunction> (quote info)))
  236. (export extended-bytefunction-info)
  237. (defconstant generic-name (simple-find-accessor <generic-function> (quote name)))
  238. (export generic-name)
  239. (defconstant generic-discriminator (simple-find-accessor <generic-function> (quote discriminator)))
  240. (export generic-discriminator)
  241. (defconstant generic-argtype (simple-find-accessor <generic-function> (quote argtype)))
  242. (export generic-argtype)
  243. (defconstant generic-fast-cache (simple-find-accessor <generic-function> (quote fast-cache)))
  244. (export generic-fast-cache)
  245. (defconstant generic-slow-cache (simple-find-accessor <generic-function> (quote slow-cache)))
  246. (export generic-slow-cache)
  247. (defconstant generic-method-table (simple-find-accessor <generic-function> (quote method-table)))
  248. (export generic-method-table)
  249. (defconstant generic-method-description (simple-find-accessor <generic-function> (quote method-description)))
  250. (export generic-method-description)
  251. (defconstant generic-method-lookup-function (simple-find-accessor <generic-function> (quote method-lookup-function)))
  252. (export generic-method-lookup-function)
  253. (defconstant generic-discrimination-depth (simple-find-accessor <generic-function> (quote discrimination-depth)))
  254. (export generic-discrimination-depth)
  255. (defconstant generic-setter (simple-find-accessor <generic-function> (quote setter)))
  256. (export generic-setter)
  257. (defconstant method-qualifier (simple-find-accessor <method> (quote method-qualifier)))
  258. (export method-qualifier)
  259. (defconstant method-signature (simple-find-accessor <method> (quote signature)))
  260. (export method-signature)
  261. (defconstant method-generic-function (simple-find-accessor <method> (quote generic-function)))
  262. (export method-generic-function)
  263. (defconstant method-function (simple-find-accessor <method> (quote function)))
  264. (export method-function)
  265. (defconstant method-fixed (simple-find-accessor <method> (quote fixed)))
  266. (export method-fixed)
  267. (defconstant condition-message (simple-find-accessor <condition> (quote message)))
  268. (export condition-message)
  269. (defconstant condition-error-value (simple-find-accessor <condition> (quote error-value)))
  270. (export condition-error-value)
  271. (defconstant invalid-operator-args (simple-find-accessor <invalid-operator> (quote args)))
  272. (export invalid-operator-args)
  273. (defconstant invalid-operator-op (simple-find-accessor <invalid-operator> (quote op)))
  274. (export invalid-operator-op)
  275. (defconstant thread-internal-state (simple-find-accessor <thread> (quote state)))
  276. (export thread-internal-state)
  277. (defconstant thread-args (simple-find-accessor <thread> (quote args)))
  278. (export thread-args)
  279. (defconstant thread-cochain (simple-find-accessor <thread> (quote cochain)))
  280. (export thread-cochain)
  281. (defconstant thread-signals (simple-find-accessor <thread> (quote signal-list)))
  282. (export thread-signals)
  283. (defconstant table-values (simple-find-accessor <table> (quote table-values)))
  284. (export table-values)
  285. (defconstant table-population (simple-find-accessor <table> (quote table-population)))
  286. (export table-population)
  287. (defconstant table-threshold (simple-find-accessor <table> (quote table-threshold)))
  288. (export table-threshold)
  289. (defconstant table-filled (simple-find-accessor <table> (quote table-filled)))
  290. (export table-filled)
  291. (defconstant table-comparator (simple-find-accessor <table> (quote table-comparator)))
  292. (export table-comparator)
  293. (defconstant table-hash-function (simple-find-accessor <table> (quote table-hash-function)))
  294. (export table-hash-function)
  295. (defconstant table-fill (simple-find-accessor <table> (quote table-fill)))
  296. (export table-fill)
  297. (defconstant sm-id (simple-find-accessor <special-method> (quote id)))
  298. (export sm-id)
  299. (defun stable-generic-method-table (gf) (if (eq (class-of gf) <generic-function>) (internal-gf-method-table gf) (generic-method-table gf)))
  300. (defun stable-generic-lookup-function (gf) (if (eq (class-of gf) <generic-function>) (internal-gf-method-lookup-function gf) (generic-method-lookup-function gf)))
  301. (defun stable-generic-name (gf) (if (eq (class-of gf) <generic-function>) (internal-gf-name gf) (generic-name gf)))
  302. (defun stable-generic-discrimination-depth (gf) (if (eq (class-of gf) <generic-function>) (internal-gf-discrimination-depth gf) (generic-discrimination-depth gf)))
  303. (defun stable-class-precedence-list (cl) (if (eq (class-of cl) <class>) (internal-class-precedence-list cl) (class-precedence-list cl)))
  304. (defconstant setter (simple-make-generic (quote argtype) 1 (quote name) (quote setter)))
  305. (export setter)
  306. (defconstant setter-setter (simple-make-generic (quote argtype) 2 (quote name) (quote setter-setter)))
  307. (export setter-setter)
  308. (simple-add-method setter-setter (simple-make-method (quote signature) (list <generic-function> <object>) (quote function) internal-gf-setter-setter))
  309. (simple-add-method setter (simple-make-method (quote signature) (list <generic-function>) (quote function) internal-gf-setter))
  310. (defun generic-method-class (gf) (car (generic-method-description gf)))
  311. (defun generic-method-domain (gf) (cdr (generic-method-description gf)))
  312. (export generic-method-domain generic-method-class)
  313. (defun set-generic-method-description (gf class domain) ((setter generic-method-description) gf (cons class domain)))
  314. (defconstant add-method-method (lambda (***method-status-handle*** ***method-args-handle*** gf meth) (if (= (generic-argtype gf) (list-length (method-signature meth))) ((lambda (sig table) (if (null table) ((generic-setter generic-method-table) gf (make-initial-table sig (list meth))) (add-table-entry table sig (list meth))) ((lambda (true-depth) (if (i-greaterp true-depth (generic-discrimination-depth gf)) ((generic-setter generic-discrimination-depth) gf true-depth) nil)) (method-signature-depth gf meth)) ((generic-setter generic-fast-cache) gf nil) ((generic-setter generic-slow-cache) gf nil) ((setter method-generic-function) meth gf) gf) (restrict-method gf (method-signature meth)) (generic-method-table gf)) (error "add-method: argument mismatch" <Internal-Error> (quote error-value) (cons gf meth)))))
  315. (export add-method-method)
  316. (defun trim-signature (gf sig) (if (i-zerop (stable-generic-discrimination-depth gf)) nil ((lambda (add-obj) (setq add-obj (lambda (last lst n) (if (i-zerop n) nil (progn ((lambda (new) (primitive-set-slot-ref-1 last new) (add-obj new (cdr lst) (i-sub1 n))) (cons (car lst) nil)))))) ((lambda (first) (add-obj first (cdr sig) (i-sub1 (stable-generic-discrimination-depth gf))) first) (cons (car sig) nil))) ())))
  317. (defun find-applicable-methods (gf args) (find-applic-methods-aux (stable-generic-method-table gf) (mapcar1 (lambda (x) (stable-class-precedence-list (class-of x))) args)))
  318. (defun find-applic-methods-aux (table cpl-lst) (if (null cpl-lst) nil (if (null (car cpl-lst)) nil ((lambda (xx) (if (null xx) (find-applic-methods-aux table (cons (cdr (car cpl-lst)) (cdr cpl-lst))) (if (null (cdr cpl-lst)) (if (methodp (car (cdr xx))) (cons (car (cdr xx)) (find-applic-methods-aux table (cons (cdr (car cpl-lst)) (cdr cpl-lst)))) (progn (cerror "yowzer" <Internal-Error> (quote error-value) xx))) (append (find-applic-methods-aux (cdr xx) (cdr cpl-lst)) (find-applic-methods-aux table (cons (cdr (car cpl-lst)) (cdr cpl-lst))))))) (assq (car (car cpl-lst)) table)))))
  319. (deflocal debug nil)
  320. (defun find-and-call-generic (gf args) ((lambda (meths sig) (if (null meths) (error "No applicable methods" no-applicable-method (quote error-value) gf (quote sig) sig (quote args) args) ((lambda (trimmed-sig) (add-method-to-caches gf trimmed-sig meths) (call-method-by-list meths args)) (trim-signature gf sig)))) ((stable-generic-lookup-function gf) args) (mapcar1 class-of args)))
  321. (defun restrict-method (gf sig) ((lambda (domain) (if (null domain) sig ((lambda (restrict-lsts) (setq restrict-lsts (lambda (sig dom) (if (null sig) nil (if (subclassp (car sig) (car dom)) (cons (car sig) (restrict-lsts (cdr sig) (cdr dom))) (if (subclassp (car dom) (car sig)) (cons (car dom) (restrict-lsts (cdr sig) (cdr dom))) (progn (error "Add-method: outside domain" <Internal-Error>) 2)))))) (restrict-lsts sig domain)) ()))) (generic-method-domain gf)))
  322. (set-compute-and-apply-fn find-and-call-generic)
  323. (defconstant add-method (simple-make-generic (quote argtype) 2 (quote lambda-list) (quote (object lst)) (quote name) (quote add-method)))
  324. (export add-method)
  325. (defconstant compute-method-lookup-function (simple-make-generic (quote argtype) 2 (quote lambda-list) (quote (object lst)) (quote name) (quote compute-method-lookup-function)))
  326. (export compute-method-lookup-function)
  327. (defconstant compute-discriminating-function (simple-make-generic (quote argtype) 4 (quote lambda-list) (quote (object lst object object)) (quote name) (quote compute-discriminating-function)))
  328. (export compute-discriminating-function)
  329. (defconstant = (simple-make-generic (quote argtype) 2 (quote lambda-list) (quote (x y)) (quote name) (quote =)))
  330. (export =)
  331. (defconstant std-allocate-object (lambda (***method-status-handle*** ***method-args-handle*** a b) (allocate-object a)))
  332. (defconstant std-initialize-object (lambda (***method-status-handle*** ***method-args-handle*** obj initlist) (initialize-local-slots obj initlist) (mapc1 (lambda (slot) ((lambda (initarg initfunction) (if (eq initarg unbound-slot-value) (if (eq initfunction unbound-slot-value) nil ((slot-description-slot-writer slot) obj (initfunction))) ((lambda (value) (if (eq value unbound-slot-value) (if (eq initfunction unbound-slot-value) nil ((slot-description-slot-writer slot) obj (initfunction))) ((slot-description-slot-writer slot) obj value))) (scan-args initarg initlist unbound-argument)))) (slot-description-initarg slot) (slot-description-initfunction slot))) (class-non-local-slot-descriptions (class-of obj))) obj))
  333. (init-generic allocate)
  334. (init-generic initialize)
  335. (init-generic generic-write)
  336. (init-generic generic-prin)
  337. (init-generic output)
  338. (init-generic generic-read)
  339. (init-generic flush)
  340. (init-generic binary+)
  341. (init-generic binary-)
  342. (init-generic binary*)
  343. (init-generic binary/)
  344. (init-generic binary-gcd)
  345. (init-generic binary-lcm)
  346. (init-generic binary<)
  347. (init-generic negate)
  348. (init-generic equal)
  349. (simple-add-method add-method (simple-make-method (quote signature) (list <generic-function> <method>) (quote function) add-method-method))
  350. (simple-add-method = (simple-make-method (quote signature) (list <fixint> <fixint>) (quote function) binary=_Integer))
  351. (add-method allocate (simple-make-method (quote signature) (list <class> <object>) (quote function) std-allocate-object))
  352. (add-method initialize (simple-make-method (quote signature) (list <object> <object>) (quote function) std-initialize-object))
  353. (add-method initialize (simple-make-method (quote signature) (list <method> <object>) (quote function) (lambda (***method-status-handle*** ***method-args-handle*** a b) ((lambda (new) ((setter method-signature) a (scan-args (quote signature) b required-argument)) (set-type new method-type) new) (if ***method-status-handle*** (progn (call-method-by-list ***method-status-handle*** ***method-args-handle***)) (error "No Next Method" <Internal-Error> nil))))))
  354. (add-method initialize (simple-make-method (quote signature) (list <generic-function> <object>) (quote function) (lambda (***method-status-handle*** ***method-args-handle*** a initargs) ((lambda (new) ((generic-setter generic-slow-cache) new nil) ((generic-setter generic-fast-cache) new nil) ((generic-setter generic-method-table) new nil) (if (eq (generic-argtype new) unbound-slot-value) ((setter generic-argtype) new (list-length (scan-args (quote lambda-list) initargs required-argument))) nil) ((lambda (domain) ((lambda (lookup-fn methods method-class) ((setter generic-method-lookup-function) new lookup-fn) ((lambda (disc-fun disc-methods) ((setter generic-discriminator) new disc-fun) (if (eq (car disc-methods) std-discrimination-method) (set-type new generic-type) nil)) (compute-discriminating-function new domain lookup-fn methods) (find-applicable-methods compute-discriminating-function (list new domain lookup-fn methods))) (set-generic-method-description new method-class domain) ((generic-setter generic-discrimination-depth) new 0) (mapc1 (lambda (meth) (add-method new meth)) methods)) (compute-method-lookup-function new domain) (scan-args (quote methods) initargs null-argument) (scan-args (quote method-class) initargs (default-argument <method>)))) (scan-args (quote domain) initargs null-argument)) new) (if ***method-status-handle*** (progn (call-method-by-list ***method-status-handle*** ***method-args-handle***)) (error "No Next Method" <Internal-Error> nil))))))
  355. (add-method compute-method-lookup-function (simple-make-method (quote signature) (list <generic-function> <object>) (quote function) (lambda (***method-status-handle*** ***method-args-handle*** gf domain) (lambda (args) (find-applicable-methods gf args)))))
  356. (defconstant std-discrimination-method (simple-make-method (quote signature) (list <generic-function> <object> <object> <object>) (quote function) (lambda (***method-status-handle*** ***method-args-handle*** gf dom lookup meths) (lambda (args) ((lambda (meths) (if (null meths) (error "No applicable method" no-applicable-method (quote error-value) gf (quote sig) (mapcar1 class-of args)) (call-method-by-list meths args))) (lookup args))))))
  357. (add-method compute-discriminating-function std-discrimination-method)
  358. (add-method generic-prin (make <method> (quote signature) (list <object> <object>) (quote function) prin-object))
  359. (add-method generic-write (make <method> (quote signature) (list <object> <object>) (quote function) (lambda (***method-status-handle*** ***method-args-handle*** x y) (generic-prin x y))))
  360. (add-method flush (make <method> (quote signature) (list <object>) (quote function) (lambda (***method-status-handle*** ***method-args-handle*** y) nil)))
  361. (deflocal no-applicable-method ())
  362. (defun set-no-applicable-method (x) (setq no-applicable-method x))
  363. (export set-no-applicable-method)
  364. (add-method allocate (make <method> (quote signature) (list <primitive-class> <object>) (quote function) (lambda (***method-status-handle*** ***method-args-handle*** c l) (error "Cannot allocate primitive class" <Internal-Error> (quote error-value) c))))
  365. (defconstant copy (make <generic-function> (quote lambda-list) (quote (x)) (quote argtype) 1 (quote name) (quote copy) (quote method-class) <method>))
  366. (add-method copy (make <method> (quote signature) (list <pair>) (quote function) (lambda (***method-status-handle*** ***method-args-handle*** x) (cons (car x) (cdr x)))))
  367. (add-method copy (make <method> (quote signature) (list (class-of nil)) (quote function) (lambda (***method-status-handle*** ***method-args-handle*** x) nil)))
  368. (add-method copy (make <method> (quote signature) (list <structure>) (quote function) (lambda (***method-status-handle*** ***method-args-handle*** x) ((lambda (copy-slots) (setq copy-slots (lambda (old new slot-list) (if (null slot-list) nil (progn ((slot-description-slot-writer (car slot-list)) new ((slot-description-slot-reader (car slot-list)) new)) (copy-slots old new (cdr slot-list)))))) (copy-slots x (allocate (class-of x) nil) (class-slot-descriptions x))) ()))))
  369. (add-method copy (make <method> (quote signature) (list <symbol>) (quote function) identity))
  370. (add-method copy (make <method> (quote signature) (list <vector>) (quote function) |generic_copy,Vector|))
  371. (export copy)
  372. (defconstant generic-hash (make <generic-function> (quote lambda-list) (quote (x)) (quote argtype) 1 (quote name) (quote generic-hash) (quote method-class) <method>))
  373. (add-method generic-hash (make <method> (quote signature) (list <i-function>) (quote function) (lambda (***method-status-handle*** ***method-args-handle*** x) 99)))
  374. (add-method generic-hash (make <method> (quote signature) (list <object>) (quote function) (lambda (***method-status-handle*** ***method-args-handle*** x) 0)))
  375. (set-standard-tab-functions generic-hash eq)
  376. (export generic-hash)
  377. (defconstant i-function-setters (make-table ()))
  378. (defconstant i-setter (lambda (***method-status-handle*** ***method-args-handle*** x) ((lambda (xx) (if (functionp xx) xx (error "Setter: no setter for function" <Internal-Error> (quote error-value) x))) (sys-table-ref i-function-setters x))))
  379. (defconstant i-setter-setter (lambda (***method-status-handle*** ***method-args-handle*** x y) (if (if (functionp x) (if (functionp y) t nil) nil) ((setter sys-table-ref) i-function-setters x y) (error "Bad setter" <Internal-Error> (quote error-value) (cons x y)))))
  380. (add-method setter (make <method> (quote signature) (list <i-function>) (quote function) i-setter))
  381. (add-method setter (make <method> (quote signature) (list <c-function>) (quote function) c-setter))
  382. (add-method setter-setter (make <method> (quote signature) (list <i-function> <object>) (quote function) i-setter-setter))
  383. (add-method setter-setter (make <method> (quote signature) (list <c-function> <object>) (quote function) c-setter-setter))
  384. (setter-setter setter setter-setter)
  385. (defconstant error (lambda (message type . junk) ((lambda (lst) (internal-signal (initialize (allocate type lst) lst) nil)) (cons (quote message) (cons message junk)))))
  386. (defconstant cerror (lambda (message type . junk) ((lambda (lst) (simple-call/cc (lambda (cont) (internal-signal (initialize (allocate type lst) lst) cont)))) (cons (quote message) (cons message junk)))))
  387. (export error cerror)
  388. (add-method binary+ (make <method> (quote signature) (list <fixint> <fixint>) (quote function) binary+_Integer))
  389. (add-method binary- (make <method> (quote signature) (list <fixint> <fixint>) (quote function) binary-_Integer))
  390. (add-method binary* (make <method> (quote signature) (list <fixint> <fixint>) (quote function) binary*_Integer))
  391. (add-method binary/ (make <method> (quote signature) (list <fixint> <fixint>) (quote function) binary/_Integer))
  392. (add-method binary-lcm (make <method> (quote signature) (list <fixint> <fixint>) (quote function) binary-lcm-integer))
  393. (add-method binary-gcd (make <method> (quote signature) (list <fixint> <fixint>) (quote function) binary-gcd-integer))
  394. (add-method binary< (make <method> (quote signature) (list <fixint> <fixint>) (quote function) binary<_Integer))
  395. (add-method negate (make <method> (quote signature) (list <fixint>) (quote function) negate-integer))
  396. )
  397.